<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="<%=request.getContextPath()%>/">
    <meta charset="UTF-8">
    <title>编辑排班</title>
    <link rel="stylesheet" href="statics/css/newsStyle.css">
</head>
<body>
<%@include file="../common/sidebar.jsp"%>
<div class="main-content">
    <%@include file="../common/top.jsp"%>
    <div class="content">
        <div class="card">
            <h2 class="section-title">编辑排班</h2>
            <form action="visit/modify" method="post">
                <!-- 隐藏域传递排班ID -->
                <input type="hidden" name="visitId" value="${visit.visitId}"/>
                <div class="form-group">
                    <label>所属科室：</label>
                    <select name="deptId" class="form-control" required>
                        <option value="">-- 请选择科室 --</option>
                        <c:forEach items="${departmentList}" var="department">
                            <option value="${department.deptId}" 
                                    <c:if test="${visit.deptId eq department.deptId}">selected</c:if>>
                                    ${department.deptName}<c:if test='${not empty department.hospital
                                    and not empty department.hospital.hospitalName}'>
                                <span style='color: #999; font-size: 12px;'>(${department.hospital.hospitalName})</span></c:if>
                            </option>
                        </c:forEach>
                    </select>
                </div>
                <div class="form-group">
                    <label>医生姓名：</label>
                    <input type="text" name="doctorName" value="${visit.doctorName}" class="form-control" required>
                </div>
                <div class="form-group">
                    <label>排班日期：</label>
                    <input type="date" name="visitDate" value="${visit.visitDate}" class="form-control" required>
                </div>
                <div class="form-group">
                    <label>排班时段：</label>
                    <select name="timeSlot" class="form-control" required>
                        <option value="8:00--12:00" <c:if test="${visit.timeSlot eq '8:00--12:00'}">selected</c:if>>8:00--12:00</option>
                        <option value="13:30--17:00" <c:if test="${visit.timeSlot eq '13:30--17:00'}">selected</c:if>>13:30--17:00</option>
                        <option value="18:00--21:00" <c:if test="${visit.timeSlot eq '18:00--21:00'}">selected</c:if>>18:00--21:00</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>可预约数量：</label>
                    <input type="number" name="maxNum" value="${visit.maxNum}" class="form-control" min="1" required>
                </div>
                <div class="form-actions">
                    <button type="submit" class="btn btn-primary">保存修改</button>
                    <a href="visit/find" class="btn btn-default">取消</a>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>